package June;

public class Test04String04 {
    public static void main(String[] args) {
        String s = " hello word i love you jiangxing1969 ";
        //去除字符串的首尾空格
        String sn = s.trim();
        int temp=0;
        String danci="";
        for (int length = sn.length()-1; length >= 0; length--) {
            //char类型需要使用单引号,并且只能加入一个字符
            if (sn.charAt(length)!=' '){
                danci=danci+sn.charAt(length);
            }else {
                //转换成StringBuilder类型才能使用reverse方法
                StringBuilder danci1=new StringBuilder(danci);
                System.out.println(danci1.reverse());
                break;
            }
        }



    }
}
